#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<string.h>
#include<stdbool.h>

#define SIZE 50001

bool StringRepeat(char* arr, int n)
{
    int count[SIZE] = { 0 };
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (arr[i] == arr[j])
            {
                count[i]++;
            }
        }
        if (count[i] >= 2)
        {
            return true;
        }
    }
    return false;
}

int lengthOfLongestSubstring(char* s)
{
    int len = strlen(s), i = 0, count[SIZE] = { 0 }, j = 0, temp = len;
    for (i = 0; i < len; i++)
    {
        char str[SIZE] = { 0 };
        int k = 0;
        for (j = 0; j < temp; j++)
        {
            str[k++] = s[j];
        }
        if (!StringRepeat(str, temp))
        {
            return temp;
        }
        temp--;
    }
    return 0;
}

int main()
{
    char str[] = "pwwkew";
    printf("%d\n", lengthOfLongestSubstring(str));
    return 0;
}